<! -- -*- tcl -*- doctools manpage
   -->
<html><head>
<title>TclJsPac - Tcl extension to evaluate proxy.pac files using TclJs </title>
</head>
<! -- Generated from file 'tcljspac.man' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2006-2007 Jos Decoster &lt;jos.decoster@gmail.com&gt;
   -->
<! -- CVS: $Id$ TclJsPac.n
   -->

<body>
<h1> TclJsPac(n) 0.1  &quot;Tcl extension to evaluate proxy.pac files using TclJs&quot;</h1>
<h2><a name="name">NAME</a></h2>
<p>
<p> TclJsPac - Tcl extension to evaluate proxy.pac files using TclJs








<h2><a name="synopsis">SYNOPSIS</a></h2>
<p>
package require <b>Tcl 8.4</b><br>
package require <b>TclJs 0.1</b><br>
package require <b>dns 1.3.1</b><br>
package require <b>ip 1.1.1</b><br>
package require <b>udp (Optionally)</b><br>
<br><table border=1 width=100% cellspacing=0 cellpadding=0><tr            bgcolor=lightyellow><td bgcolor=lightyellow><table 0 width=100% cellspacing=0 cellpadding=0><tr valign=top ><td ><a href="#1"><b class='cmd'>::js::pac::isPlainHostName</b> <i class='arg'>host</i></a></td></tr>
<tr valign=top ><td ><a href="#2"><b class='cmd'>::js::pac::dnsDomainIs</b> <i class='arg'>host</i> <i class='arg'>domain</i></a></td></tr>
<tr valign=top ><td ><a href="#3"><b class='cmd'>::js::pac::localHostOrDomainIs</b> <i class='arg'>host</i> <i class='arg'>hostdom</i></a></td></tr>
<tr valign=top ><td ><a href="#4"><b class='cmd'>::js::pac::isResolvable</b> <i class='arg'>host</i></a></td></tr>
<tr valign=top ><td ><a href="#5"><b class='cmd'>::js::pac::isInNet</b> <i class='arg'>host</i> <i class='arg'>pattern</i> <i class='arg'>mask</i></a></td></tr>
<tr valign=top ><td ><a href="#6"><b class='cmd'>::js::pac::dnsResolve</b> <i class='arg'>host</i></a></td></tr>
<tr valign=top ><td ><a href="#7"><b class='cmd'>::js::pac::myIpAddress</b> </a></td></tr>
<tr valign=top ><td ><a href="#8"><b class='cmd'>::js::pac::dnsDomainLevels</b> <i class='arg'>host</i></a></td></tr>
<tr valign=top ><td ><a href="#9"><b class='cmd'>::js::pac::shExpMatch</b> <i class='arg'>str</i> <i class='arg'>shexp</i></a></td></tr>
<tr valign=top ><td ><a href="#10"><b class='cmd'>::js::pac::weekdayRange</b> <i class='arg'>weekDay</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#11"><b class='cmd'>::js::pac::weekdayRange</b> <i class='arg'>weekDayFrom</i> <i class='arg'>weekDayTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#12"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>day</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#13"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>dayFrom</i> <i class='arg'>dayTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#14"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>month</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#15"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>monthFrom</i> <i class='arg'>monthTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#16"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>year</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#17"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>yearFrom</i> <i class='arg'>yearTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#18"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>day</i> <i class='arg'>month</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#19"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>dayFrom</i> <i class='arg'>monthFrom</i> <i class='arg'>dayTo</i> <i class='arg'>monthTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#20"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>month</i> <i class='arg'>year</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#21"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>monthFrom</i> <i class='arg'>yearFrom</i> <i class='arg'>monthTo</i> <i class='arg'>yearTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#22"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>dayFrom</i> <i class='arg'>monthFrom</i> <i class='arg'>yearFrom</i> <i class='arg'>dayTo</i> <i class='arg'>monthTo</i> <i class='arg'>yearTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#23"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hour</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#24"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hourFrom</i> <i class='arg'>hourTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#25"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hourFrom</i> <i class='arg'>minuteFrom</i> <i class='arg'>hourTo</i> <i class='arg'>minuteTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#26"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hourFrom</i> <i class='arg'>minuteFrom</i> <i class='arg'>secondFrom</i> <i class='arg'>hourTo</i> <i class='arg'>minuteTo</i> <i class='arg'>secondTo</i> ?<i class='arg'>gmt</i>?</a></td></tr>
<tr valign=top ><td ><a href="#27"><b class='cmd'>::js::pac::addToJsInterp</b> <i class='arg'>jsInterp</i></a></td></tr>
</table></td></tr></table>
<h2><a name="description">DESCRIPTION</a></h2>
<p>

<p> 

This extension makes it possible to evaluate <em>proxy.pac</em> files using the
<strong>TclJs</strong> package. To do so, some predefined JavaScript functions are
required. The Tcl <strong>TclJsPac</strong> package provides these functions.

<h2><a name="commands">COMMANDS</a></h2>
<p>

The commands below are required to evaluate <em>proxy.pac</em> files. They have 
to be registerd as functions in a JavaScript interpreter before evaluating
<em>proxy.pac</em> files. Registering can be done using the 
<b class='cmd'>::js::pac::addToJsInterp</b> command. More information about <em>proxy.pac</em>
files and about these commands can be found here:

<p>
<a href="http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html">http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html</a>

<p>
Some commands have a <i class='arg'>day</i> argument. This must be specified as a integer 
from 1 to 31.

<p>
Some commands have a <i class='arg'>week</i> argument. This must be specified with one of 
the  following 3 letter abreviations: <strong>SUN</strong>, <strong>MON</strong>, <strong>TUE</strong>, 
<strong>WED</strong>, <strong>THU</strong>, <strong>FRI</strong> or <strong>SAT</strong>.

<p>
Some commands have a <i class='arg'>month</i> argument. This must be specified with one of 
the following 3 letter abreviations: <strong>JAN</strong> <strong>FEB</strong> <strong>MAR</strong> 
<strong>APR</strong> <strong>MAY</strong> <strong>JUN</strong> <strong>JUL</strong> <strong>AUG</strong> <strong>SEP</strong> 
<strong>OCT</strong>  <strong>NOV</strong> <strong>DEC</strong>.

<p>
Some commands have a <i class='arg'>year</i> argument. This must be specified as a 4 digit 
year (e.g. 2007, 1999, ...). 

<p>
Several of these commands have a optional <i class='arg'>gmt</i> argument. When <i class='arg'>gmt</i> 
has  the value <strong>GMT</strong>, times are relative to Greenwich Mean Time. When 
<i class='arg'>gmt</i>  is not specified or has the value <strong>LOC</strong>, local times are used.

<p> 
Host names, domain names, abbreviations used to specify days of the week or
months and abbreviations to specify Greenwich Mean Time or local time are case
insensitive.

<dl>

<dt><a name="1"><b class='cmd'>::js::pac::isPlainHostName</b> <i class='arg'>host</i></a><dd>


True if there is no domain name in <i class='arg'>host</i> (no dots).

<br><br>
<dt><a name="2"><b class='cmd'>::js::pac::dnsDomainIs</b> <i class='arg'>host</i> <i class='arg'>domain</i></a><dd>


Returns true if the domain of <i class='arg'>host</i> matches <i class='arg'>domain</i>.

<br><br>
<dt><a name="3"><b class='cmd'>::js::pac::localHostOrDomainIs</b> <i class='arg'>host</i> <i class='arg'>hostdom</i></a><dd>


Is true if the <i class='arg'>host</i> matches exactly <i class='arg'>hostdom</i>, or if there is no 
domain  name part in <i class='arg'>host</i>, but the unqualified <i class='arg'>host</i> matches the 
host name in  <i class='arg'>hostdom</i>.

<br><br>
<dt><a name="4"><b class='cmd'>::js::pac::isResolvable</b> <i class='arg'>host</i></a><dd>


Tries to resolve <i class='arg'>host</i>. Returns true if succeeds.

<br><br>
<dt><a name="5"><b class='cmd'>::js::pac::isInNet</b> <i class='arg'>host</i> <i class='arg'>pattern</i> <i class='arg'>mask</i></a><dd>


True if the IP address of <i class='arg'>host</i> matches the specified <i class='arg'>pattern</i> after 
applying <i class='arg'>mask</i>.

<br><br>
<dt><a name="6"><b class='cmd'>::js::pac::dnsResolve</b> <i class='arg'>host</i></a><dd>


Resolves the given DNS <i class='arg'>host</i> into an IP address, and returns it in the dot
separated format as a string.

<br><br>
<dt><a name="7"><b class='cmd'>::js::pac::myIpAddress</b> </a><dd>


Returns the IP address of the host as a string in the dot-separated integer 
format.

<br><br>
<dt><a name="8"><b class='cmd'>::js::pac::dnsDomainLevels</b> <i class='arg'>host</i></a><dd>


Returns the number (integer) of DNS domain levels (number of dots) in 
<i class='arg'>host</i>.

<br><br>
<dt><a name="9"><b class='cmd'>::js::pac::shExpMatch</b> <i class='arg'>str</i> <i class='arg'>shexp</i></a><dd>


Returns true if <i class='arg'>str</i> matches the specified shell expression <i class='arg'>shexp</i>. 
Matching is done using <b class='cmd'>string match</b>.

<br><br>
<dt><a name="10"><b class='cmd'>::js::pac::weekdayRange</b> <i class='arg'>weekDay</i> ?<i class='arg'>gmt</i>?</a><dd>


Returns true if the current day is the specified day.

<br><br>
<dt><a name="11"><b class='cmd'>::js::pac::weekdayRange</b> <i class='arg'>weekDayFrom</i> <i class='arg'>weekDayTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="12"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>day</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="13"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>dayFrom</i> <i class='arg'>dayTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="14"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>month</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="15"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>monthFrom</i> <i class='arg'>monthTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="16"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>year</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="17"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>yearFrom</i> <i class='arg'>yearTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="18"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>day</i> <i class='arg'>month</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="19"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>dayFrom</i> <i class='arg'>monthFrom</i> <i class='arg'>dayTo</i> <i class='arg'>monthTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="20"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>month</i> <i class='arg'>year</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="21"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>monthFrom</i> <i class='arg'>yearFrom</i> <i class='arg'>monthTo</i> <i class='arg'>yearTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="22"><b class='cmd'>::js::pac::dateRange</b> <i class='arg'>dayFrom</i> <i class='arg'>monthFrom</i> <i class='arg'>yearFrom</i> <i class='arg'>dayTo</i> <i class='arg'>monthTo</i> <i class='arg'>yearTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="23"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hour</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="24"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hourFrom</i> <i class='arg'>hourTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="25"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hourFrom</i> <i class='arg'>minuteFrom</i> <i class='arg'>hourTo</i> <i class='arg'>minuteTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="26"><b class='cmd'>::js::pac::timeRange</b> <i class='arg'>hourFrom</i> <i class='arg'>minuteFrom</i> <i class='arg'>secondFrom</i> <i class='arg'>hourTo</i> <i class='arg'>minuteTo</i> <i class='arg'>secondTo</i> ?<i class='arg'>gmt</i>?</a><dd>


<dt><a name="27"><b class='cmd'>::js::pac::addToJsInterp</b> <i class='arg'>jsInterp</i></a><dd>


Adds all commands listed above to the specified JavaScript interpreter 
<i class='arg'>jsInterp</i> with function names and returns type as needed to evaluate 
<em>proxy.pac</em> files.

</dl>


<h2><a name="keywords">KEYWORDS</a></h2>
<p>
JavaScript, SpiderMonkey, proxy.pac
<h2><a name="copyright">COPYRIGHT</a></h2>
<p>
Copyright &copy; 2006-2007 Jos Decoster &lt;jos.decoster@gmail.com&gt;<br>
</body></html>

